package org.domain.sigerec.entity;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.validator.NotNull;

@Entity
public class Cruzeiro implements Serializable {
	
	private static final long serialVersionUID = -3535799814103628697L;
	private Long id;
	private String nome;
	private Date saida;
	private Date chegada;
	private Navio navio;
	private List<Reserva> reservas;
	
	public Cruzeiro() {
		
	}
	
	@Id @GeneratedValue
	public Long getId() {
	     return id;
	}

	public void setId(Long id) {
	     this.id = id;
	}

	public String getNome() {
		return nome;
	}

	public void setNome(String nome) {
		this.nome = nome;
	}

	@Temporal(TemporalType.TIMESTAMP)
	public Date getSaida() {
		return saida;
	}

	public void setSaida(Date saida) {
		this.saida = saida;
	}

	@Temporal(TemporalType.TIMESTAMP)
	public Date getChegada() {
		return chegada;
	}

	public void setChegada(Date chegada) {
		this.chegada = chegada;
	}

	@ManyToOne
	@NotNull
	@JoinColumn(name = "navio_id")
	public Navio getNavio() {
		return navio;
	}

	public void setNavio(Navio navio) {
		this.navio = navio;
	}
	
	public void setReservas(List<Reserva> r) {
		this.reservas = r;
	}

	@OneToMany(mappedBy="cruzeiro")
	public List<Reserva> getReservas() {
		return reservas;
	}

	
}
